import * as http from '@/utils/http'

export function getBanners (page, perPage) {
  return http.get('/v1/banners', {page: page, perPage: perPage})
}

export function getTeachers (page, perPage) {
  return http.get('/v1/teachers', {page: page, perPage: perPage})
}

export function getRecommend () {
  return http.get('/v1/cates/recommend')
}

export function getCourse (id) {
  return http.get('/v1/courses/' + id)
}

export function getCourseCatalog (courseId) {
  return http.get('/v1/courseCatalog/' + courseId)
}

export function feedbacks (title, content) {
  return http.post('/v1/feedbacks', {title: title, content: content})
}

export function getNews () {
  return http.get('/v1/notices')
}

export function getBookList () {
  return http.get('/v1/textbooks')
}

export function getBook (id) {
  return http.get('/v1/textbooks/' + id)
}

export function getCourse_info (id) {
  return http.get('/v1/courses/' + id)
}

export function getTeacher (id) {
  return http.get('/v1/teachers/' + id)
}

export function getSchool () {
  return http.get('/v1/school-intro')
}

export function getCoursesList () {
  return http.get('/v1/courses')
}

export function getArticlesList () {
  return http.get('/v1/articles')
}

export function getArticles (id) {
  return http.get('/v1/articles/' + id)
}

export function favorites (data) {
  return http.post('/v1/favorites', {data: data})
}

export function getFavorites (type) {
  return http.get('/v1/favorites/' + type)
}

export function accountDetail () {
  return http.get('/v1/accountDetail')
}

export function getCustomer () {
  return http.get('/v1/customer')
}

export function getTeacherCustomer (teacherId) {
  return http.get('/v1/teacher/courses/' + teacherId)
}

export function getAddressList () {
  return http.get('v1/consignees')
}

export function getAddress (id) {
  return http.get('/v1/consignees/' + id)
}

export function addAddress (data) {
  console.log(data)
  return http.post('/v1/consignees', data)
}

export function updateAddress (id, data) {
  return http.put('/v1/consignees/' + id, data)
}

export function delAddress (id) {
  return http.del('v1/consignees/' + id)
}

export function getCourses (params) {
  return http.get('v1/courses', params)
}

export function getCourseLog (id, param) {
  return http.get('/v1/courseCatalog/' + id, param)
}
export function getCatalog (id) {
  return http.get('/v1/catalog/' + id)
}


